package com.landiao.ctrler.management;

import java.util.List;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.landiao.ctrler.BaseCRUDCtrler;
import com.landiao.entities.Shop;
import com.landiao.entities.SysConfig;
import com.landiao.entities.Title;
import com.landiao.entities.Vip;
import com.landiao.service.SysConfigService;
import com.landiao.service.TitleService;

/**
 * 功能说明:系统配置
 *
 */
@Controller
@RequestMapping("/management/title")
public class TitleCtrler extends BaseCRUDCtrler<Title, String> {

	private TitleService getTitleService() {
        return (TitleService) baseService;
    }
	
	@ResponseBody
	@RequestMapping("listTitle")
	public List<Title> listshop(Title title){
		title.setCompId(this.getClientUser().getUser().getCompId());
		List<Title> titles = this.getTitleService().getAllTitleList(title);
		return titles;
	}
	/**
	 * 验证头衔是否存在
	 * 
	 */
	@RequestMapping("isExist")
	@ResponseBody
	public boolean isExist(String name, String id) {
		Title title = this.getTitleService().getByName(name);
		if (title == null) {
			return true;
		} else {
			if (title.getTitleId().equals(id)) {
				return true;
			} else {
				return false;
			}
		}
	}
}
